function Show-StatWelcomeMessage
{ 
    Write-Host "Michael Nigels (http://www.AllThingsMicrosoft.com)"
    Write-Host "PowerShell Automation Tools for SharePoint (Web Service Edition) v$versionText"
    Write-Host
    Write-Host "Welcome to the SharePoint Total Automation Toolkit Web Service Edition (StatWse)" 
    Write-Host "=========================================================================================" 
    Write-Host
    Write-Host "GETTING STARTED"
    Write-Host "     More info coming soon."
    Write-Host "     To see a complete list of available StatWse functions type " -NoNewline
    Write-Host "Get-StatWseFunctions " -ForegroundColor Yellow
    Write-Host "     at the command prompt."
    Write-Host
    Write-Host "     To return to this menu at any time type " -NoNewline
    Write-Host "Show-StatWseMenu " -ForegroundColor Yellow -NoNewline
    Write-Host "     at the command prompt."
    Write-Host
    Write-Host "ADDITIONAL HELP"
    Write-Host "     All scripts in this toolkit make use of the PowerShell help system. To get additional"
    Write-Host "     information about any script or function in this toolkit use the " -NoNewline
    Write-Host "Get-Help " -NoNewline
    Write-Host "command"
    Write-Host "     Example (for functions): " -NoNewline
    Write-Host "Get-Help New-StatSPMetadataServiceApplication " -ForegroundColor Yellow
    Write-Host "     Example (for .ps1 scripts): " -NoNewline
    Write-Host "Get-Help .\17-CreateInitialSiteTopology.ps1 " -ForegroundColor Yellow
    Write-Host 
} 

function Show-StatWseMenu([boolean] $showWelcomeMessage = $true)
{
    if ($showWelcomeMessage -eq $true)
    {
        cls
        Show-StatWelcomeMessage
    }

    $prompt =  "     Where would you like to begin? `n`n"
    $prompt += "     Scripts`n"
    $prompt += "     [ 1] General Macros `n`n"
    $prompt += "     General `n"
    $prompt += "     [ 2] Command Prompt `n`n"
    $prompt += "     Please select a number (1-2)"

    switch (Read-Host $prompt)
    {
        1
        {
            Set-Location "$STATHome\Scripts"
            dir | Format-Table @{Expression={$_.Name};Label="Available Scripts"}
        }
        
        default
        {
            Write-Host
            Set-Location "$STATHome"
        }
    }
} 

function prompt
{ 

   Write-Host "STATWSE " -NoNewline
   Write-Host (pwd).Path.Replace($STATHome, '~') -NoNewline
   Write-Host '>' -NoNewline
   Return ' ' 
} 

function Get-StatWseFunctions
{
    Get-ChildItem function:* | Where-Object {$_.Module -Match "SPTotalAutomationToolkitWSE"} | Format-Table Name
}


#
# Main Script
#

CLS
$STATHome = "${env:ProgramFiles(x86)}\SharePoint Total Automation Toolkit WSE"

Set-Location "$STATHome\Scripts"

$versionFile = "${env:ProgramFiles(x86)}\SharePoint Total Automation Toolkit WSE\Modules\Version.csv"
$versions = Import-Csv $versionFile
if ($versions -ne $null)
{
    foreach ($version in $versions)
    {
        $versionText = $version.Major + "." + $version.Minor + "." + $version.Build + "." + $version.Revision
    }
}

# Display the Welcome Message
Show-StatWelcomeMessage 

# Import the SharePoint Total Automation Toolkit Modules
Import-Module "${env:ProgramFiles(x86)}\SharePoint Total Automation Toolkit WSE\Modules\SPTotalAutomationToolkitWSE.Common"
Import-Module "${env:ProgramFiles(x86)}\SharePoint Total Automation Toolkit WSE\Modules\SPTotalAutomationToolkitWSE.FarmConfig"
Import-Module "${env:ProgramFiles(x86)}\SharePoint Total Automation Toolkit WSE\Modules\SPTotalAutomationToolkitWSE.SiteConfig"

# Display the STAT Menu
Show-StatWseMenu $false